@import "../common/vars.scss";
@import "../mixins/mixins.scss";
//公共
@include create(textarea) {
  display: inline-block;
  width: 100%;
  vertical-align: bottom;
  font-size: $font-size-base;

  @include e(inner) {
    display: block;
    resize: vertical;
    padding: 5px 15px;
    line-height: 1.5;
    box-sizing: border-box;
    width: 100%;
    font-size: inherit;
    color: $input-color;
    background-color: $input-fill;
    background-image: none;
    border: $input-border;
    border-radius: $input-border-radius;
    transition: $border-transition-base;

    &::placeholder {
      color: $input-placeholder-color;
    }

    &:hover {
      border-color: $input-hover-border;
    }

    &:focus {
      outline: none;
      border-color: $input-focus-border;
    }
  }
  @include when(disabled) {
    .aiui-textarea-inner {
      background-color: $input-disabled-fill;
      border-color: $input-disabled-border;
      color: $input-disabled-color;
      cursor: not-allowed;

      &::placeholder {
        color: $input-disabled-placeholder-color;
      }
    }
  }
}

@include create(input) {
  position: relative;
  font-size: $font-size-base;
  display: inline-block;
  width: 100%;

  @include when(disabled) {
    .aiui-input-inner {
      background-color: $input-disabled-fill;
      border-color: $input-disabled-border;
      color: $input-disabled-color;
      cursor: not-allowed;

      &::placeholder {
        color: $input-disabled-placeholder-color;
      }

      &:focus{
        border-color: $input-disabled-border;
      }
    }

    .aiui-input-icon {
      cursor: not-allowed;
    }
  }

  @include m(inner) {
    appearance: none;
    background-color: $input-fill;
    background-image: none;
    border-radius: $input-border-radius;
    border: $input-border;
    box-sizing: border-box;
    color: $input-color;
    display: inline-block;
    font-size: inherit;
    height: $input-base-height;
    line-height: $input-base-height;
    outline: none;
    padding: 0 15px;
    transition: $border-transition-base;
    width: 100%;

    &::placeholder {
      color: $input-placeholder-color;
    }

    &:hover {
      border-color: $input-hover-border;
    }

    &:focus {
      outline: none;
      border-color: $input-focus-border;
    }
    &[disabled] {
        background-color: $input-disabled-fill;
        border-color: $input-disabled-border;
        color: $input-disabled-color;
        cursor: not-allowed;

        &::placeholder {
          color: $input-disabled-placeholder-color;
        }
    }
  }

  @include e(suffix) {
    position: absolute;
    height: 100%;
    right: 5px;
    top: 0;
    text-align: center;
    color: $input-icon-color;
    transition: all 0.3s;
    pointer-events: none;
  }

  @include e(suffix-inner) {
    pointer-events: all;
  }

  @include e(prefix) {
    position: absolute;
    height: 100%;
    left: 5px;
    top: 0;
    text-align: center;
    color: $input-icon-color;
    transition: all 0.3s;
  }

  @include e(icon) {
    height: 100%;
    width: 25px;
    text-align: center;
    transition: all 0.3s;
    line-height: $input-base-height;

    &:after {
      content: "";
      height: 100%;
      width: 0;
      display: inline-block;
      vertical-align: middle;
    }
  }

  @include m(suffix) {
    .aiui-input-inner {
      padding-right: 30px;
    }
  }

  @include m(prefix) {
    .aiui-input-inner {
      padding-left: 30px;
    }
  }

  @include m(mini) {
    font-size: $input-mini-font-size;

    @include e(inner) {
      height: $input-mini-height;
      line-height: $input-mini-height;
    }

    .aiui-input-icon {
      line-height: $input-mini-height;
    }
  }
}


@include create(input-group){
    line-height: normal;
    display: inline-table;
    width: 100%;
    border-collapse: separate;
    border-spacing:0;

    > .aiui-input-inner {
      vertical-align: middle;
      display: table-cell;
    }

    @include e((append, prepend)) {
      background-color: $background-color-base;
      color: $color-info;
      vertical-align: middle;
      display: table-cell;
      position: relative;
      border: $border-base;
      border-radius: $input-border-radius;
      padding: 0 20px;
      width: 1px;
      white-space: nowrap;
  
      &:focus {
        outline: none;
      }
  
      .aiui-select,
      .aiui-btn {
        display: inline-block;
        margin: -10px -20px;
      }
  
      button.aiui-btn,
      div.aiui-select .aiui-input-inner,
      div.aiui-select:hover .aiui-input-inner {
        border-color: transparent;
        background-color: transparent;
        color: inherit;
        border-top: 0;
        border-bottom: 0;
      }
  
      .aiui-btn,
      .aiui-input {
        font-size: inherit;
      }
    }

    @include e(prepend) {
      border-right: 0;
      border-top-right-radius: 0;
      border-bottom-right-radius: 0;
    }
  
    @include e(append) {
      border-left: 0;
      border-top-left-radius: 0;
      border-bottom-left-radius: 0;
    }

    @include m(prepend) {
      .aiui-input-inner {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
      }
      .aiui-select .aiui-input.is-focus .aiui-input-inner {
        border-color: transparent;
      }
    }
  
    @include m(append) {
      .aiui-input-inner {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
      }
      .aiui-select .aiui-input.is-focus .aiui-input-inner {
        border-color: transparent;
      }
    }
}
